package com.wedimob.boxinternetprotection.freebox;

import java.util.HashMap;
import java.util.Map;
import java.util.Observable;

public class FreeboxStatus extends Observable {
    private Freebox freebox;
    Map<String, String> properties = new HashMap<String, String>();

    public FreeboxStatus(Freebox freebox) {
        this.freebox = freebox;
    }

    public void clear() {
        properties.clear();
    }

    public String getProp(String name) {
        return properties.get(name);
    }

    public void addProp(String name, String value) {
        String previousValue = getProp(name);
        properties.put(name, value);
        if (!value.equals(previousValue)) {
            notifyObservers(this);
        }
    }

    public int size() {
        return properties.size();
    }

    @Override
    public String toString() {
        return freebox + " [" + properties.toString() + "]";
    }
}
